{%extends "base/page.html"%}
{%block title%}Search results{%endblock%}
{%block contents%}

<h1>Site Search <i class="fas fa-link"></i></h1>
<form method="get" action="/search/">
  {%if suburl%}
   <input type="hidden" name="u" value="{{suburl}}">
  {%endif%}
  <div class="row">
    <div class="col-lg-6">
      <div class="input-group">
        <input type="text" name="q" value="{{query}}" class="form-control" placeholder="Search for...">
        <span class="input-group-btn">
          <button class="btn btn-default" type="submit">
            <i class="fas fa-search"></i>
          </button>
        </span>
      </div><!-- /input-group -->
    </div><!-- /.col-lg-6 -->
  </div><!-- /.row -->
</form>

{%if search_error %}
<div>{{search_error}}</div>
{%else%}
<!-- docbot goes here -->
{%if hitcount == 0 %}
 <p>Your search for <strong>{{query}}</strong> returned no hits.</p>
{%else%}
 <h2>Results {{firsthit}}-{{lasthit}} of {%if hitcount == 1000%}more than 1000{%else%}{{hitcount}}{%endif%}.</h2>
 {%if pagelinks %}Result pages: {{pagelinks|safe}}<br/><br/>{%endif%}
 {%for hit in hits %}
  {{forloop.counter0|add:firsthit}}. <a href="{{hit.url}}">{{hit.title}}</a> [{{hit.rank|floatformat:2}}]<br/>
  <div>...{{hit.abstract|safe}}...</div>
  <a href="{{hit.url}}">{{hit.url}}</a><br/>
  <br/>
 {%endfor%}
 {%if pagelinks %}Result pages: {{pagelinks|safe}}<br/><br/>{%endif%}
{%endif%}
{%endif%}
{%endblock%}
